﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using EZCRS.HCMS.Data;
using EZCRS.HCMS.Entity;

namespace EZCRS.HCMS.SqlClient
{
    public class sql_hcrs_hotel
    {
        /// <summary>
        /// 返回单条酒店信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HCRS_Hotel getitem(int id)
        {
            return new HCRS_Hotel(ExecSql.GetDataSet("select * from HCRS_Hotel where hotel_id=" + id.ToString()).Tables[0].Rows[0]);
        }

        public HCRS_Hotel GetHotelByPID(int PID)
        {
            return new HCRS_Hotel(ExecSql.GetDataSet("select * from HCRS_Hotel where pid=" + PID.ToString()).Tables[0].Rows[0]);
        }

        public bool insertorupdate(HCRS_Hotel _hotel)
        {
            return ExecSql.InsertOrUpdateData<HCRS_Hotel>(_hotel);
        }

        public bool updatestatus(int pid, string status)
        {
            if (ExecSql.SqlExecNoquery("update HCRS_Hotel set status='" + status + "' where pid=" + pid.ToString() + "") > 0)
                return true;
            else
                return false;
        }
    }
}
